﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Threading;

namespace PilotMVC
{
    public class TimerView
    {
        public int Minutes { get; set; }

        private Thread _runningTime;

        public int UpdatedTime
        {
            get
            {
                return Minutes;
            }
        }


        public void Start()
        {
            if (_runningTime == null)
            {
                _runningTime = new Thread(run);
                _runningTime.Start();
            }
        }

        private void run()
        {
            while (true)
            {
                Thread.Sleep(60000);
                Minutes = Minutes-1;
              //  this.UpdateTime();
            }
        }

        private int UpdateTime()
        {
            return this.Minutes;
        }
     

    }
}